<template>
	<sl-page title="门店信息">
		<!-- 表单组件 -->
		<view class="bankCards">
			<view class="flex flex-x-center py-1">
				<view class="iconfont icon-mendianhexiao"></view>
			</view>
			
			<view class="s-form">
				<view class="s-form__item">
					<view class="s-form__item--control">
						<input class="form-item--input" type="text" v-model="form.name" maxlength="30"
							placeholder="请输入核销码" />
					</view>
				</view>
				<view class="">
					
				</view>
			</view>
		</view>
		<view class="action btn-primary" :class="{'disable': !verifyPassed}" @click.stop="onSubmit()">提交
		</view>
	</sl-page>
</template>

<script>
	import * as Verify from '@/utils/verify';
	import TenantOrderApi from '@/api/order/tenantOrder.js';
	import Constants from '@/constants';

	export default {
		//
		name: 'updateStore',
		//
		mixins: [Constants],
		//
		components: {},

		//
		data() {
			return {
				form: {
					verificationCode: '',
				},

				verifyPassed_verificationCode: false,
				tenantId: '',
				storeId: ''
			};
		},
		//
		watch: {
			'form.verificationCode': function() {
				this.verifyPassed_verificationCode = this.VerifyVerificationCode();
			},
		},
		//
		computed: {
			verifyPassed: function() {
				return this.verifyPassed_verificationCode;
			}
		},
		onLoad(options) {
			this.options = options;
			this.initPara();
		},
		//
		methods: {
			initPara() {
				//
				this.tenantId = this.options.tenantId ?? '';
				this.storeId = this.options.storeId ?? '';
			},
			//
			VerifyVerificationCode: function() {
				return !Verify.isEmpty(this.form.verificationCode);
			},
			
			//
			onSubmit() {
				if (!this.VerifyVerificationCode()) {
					this.$app.toast('请输入门店核销码')
					return;
				}
				this.doSubmit();
			},
			//
			doSubmit() {
				TenantOrderApi.check_off(this.form).then((res) => {
					this.$app.toast('修改成功');
					// this.onBackPage();
				});
			},
			//
			onBackPage: function() {
				// this.$app.redirectTo(this.pages.indexStorePage);
			}
		}
	};
</script>

<style lang="scss" scoped>

</style>